<?php $this->set('title', 'My Surveys'); ?>
<?php $this->set('external_css', array('surveys.css')); ?>
<?php $session->flash();?>
<div class="header">My Surveys</div>
<?php echo $html->link("All Surveys",
		  array('controller' => 'audiences', 'action' => 'search_surveys')); ?>
 | My Surveys
<br /><br />
<span style="font-size:18px;font-weight:bold;">Search Surveys</span>&nbsp;&nbsp;
<?php echo $html->link("Show All",
		  array('controller' => 'audiences', 'action' => 'show_all_my_surveys')); ?>
		  
<!-- Audience Surveys Search -->
<?php echo $this->element('audience_surveys_search',
				array("controller" => "Audiences", "action" => "my_surveys"));?>
				
<?php if($display) { ?>
<table cellpadding="5" cellspacing="0" border="0">
	<tr>
		<td><?php echo $paginator->sort('Name', 'name'); ?></td>
		<td><?php echo $paginator->sort('Unique ID', 'uuid'); ?></td>
		<td><?php echo $paginator->sort('Survey Type', 'SurveyType.type'); ?></td>
	</tr>
	<?php foreach ($surveys as $survey): ?>
		<tr>
			<td><?php echo $html->link($survey['Survey']['name'],
			 array('controller' => 'surveys', 'action' => 'user_view', '0' => $survey['Survey']['id'], '1' => '1')); ?></td>
			<td><?php echo substr($survey['Survey']['uuid'],1,8); ?></td>
			<td><?php echo $survey['SurveyType']['type']; ?></td>
		</tr>
	<?php endforeach; ?>
		<tr>
			<!-- Pagination -->
			<td colspan="3">
				<!-- Shows the next and previous links -->
				<?php
					echo $paginator->prev('« Previous ', null, null, array('class' => 'disabledPageLink'));
					echo $paginator->next(' Next »', null, null, array('class' => 'disabledPageLink'));
				?>
				<br />
				<!-- prints X of Y, where X is current page and Y is number of pages -->
				<?php echo $paginator->counter(); ?>
			</td>
		</tr>
</table>
<?php } else { ?>
	<span class="errMsg">No surveys found</span>
<?php } ?>
<br /><br />